package data;

import java.io.File;
import java.io.FileReader;
import java.util.Properties;
import java.io.IOException;

public class Credentials {
	
	public static String[] readFromFile(File file) throws IOException {
		
		Properties props = new Properties();
		props.load(new FileReader(file));
		
		String username = props.getProperty("dbUser");
		String password = props.getProperty("dbPassword");
		
		if (username == null) throw new IOException("dbUser ikke sat i " + file);
		else if (password == null) throw new IOException("dbPassword ikke sat i " + file);
		
		else {
			String[] out = new String[2];
			
			out[0] = username;
			out[1] = password;
			
			return out;
		}
		
		
	}
}
